fix(gemini): avoid duplicate structured schema prompt#2277
Conversation
|
I did a quick local check because the only red job is Targeted checks on this branch passed for me: uv run --project hindsight-api-slim pytest hindsight-api-slim/tests/test_llm_extra_body.py -q
uv run --project hindsight-api-slim ruff format --check hindsight-api-slim/hindsight_api/engine/providers/gemini_llm.py hindsight-api-slim/tests/test_llm_extra_body.py
uv run --project hindsight-api-slim ruff check hindsight-api-slim/hindsight_api/engine/providers/gemini_llm.py
git diff --checkResult: |
|
@koriyoshi2041 confirmed — thanks for the targeted verification. The red |
nicoloboschi
left a comment
There was a problem hiding this comment.
Approving. Verified the structured-output behavior with a Gemini LOCOMO run on conv-26 (this branch, isolated DB): 89.5% accuracy (136/152) and zero invalid-JSON / prompt-fallback events across ~70 ingestion fact-extractions + 152 recall/QA cycles. Native response_schema-only path is robust; removing the duplicate prompt-side schema does not degrade Gemini output.
Summary
system_instructionwhen nativeresponse_schemais already sentresponse_schemaon normal and cached structured callsFixes #1070.
Tests
uv run --project hindsight-api-slim pytest hindsight-api-slim/tests/test_llm_extra_body.py -quv run --project hindsight-api-slim ruff format --check hindsight-api-slim/hindsight_api/engine/providers/gemini_llm.py hindsight-api-slim/tests/test_llm_extra_body.pyuv run --project hindsight-api-slim ruff check hindsight-api-slim/hindsight_api/engine/providers/gemini_llm.pygit diff --checkCodex adversarial review approved after reworking the cached retry path so it does not drop cached context.